<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            font-size: 22px;
            margin-left: 300px;
            margin-top: 100px;
        }
        
        #btn {
            width: 100px;
            height: 50px;
        }
    </style>
</head>

<body>
    <button id="btn">开始</button>
    <span id="result">0</span>
    <script>
        const btn = document.getElementById("btn");
        const result = document.getElementById("result");

        const timer = {
            time: 0,
            start: function() {
                btn.addEventListener("click", function(e) {
                    setTimeout(function() {
                        this.time++;
                        result.innerHTML = this.time;
                    }, 1000)
                }, false)
            }
        }

        timer.start();
    </script>
</body>

</html>